﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SSN.Objects;
using SSN.Security.Token;

namespace SSN.Utilities.Security {
	public class TestSecurityContext:SSNSecurityContext {

		private string _userID;
		private List<string> _roles;

		public TestSecurityContext():this("test",new List<string>()) {}

		public TestSecurityContext(string userID):this(userID,new List<string>()) {}

		public TestSecurityContext(List<string> roles):this("test",roles) {}

		public TestSecurityContext(string userID,List<string> roles) {
			userid=userID;
			allRoles=roles;
		}

		#region SSNSecurityContext Members

		public bool IsAuthenticated {
			get { return true; }
		}

		public bool IsInRole(string rolename) {
			return allRoles.Contains(rolename);
		}

		public bool IsValid {
			get { return true; }
		}

		public SSNSecurityToken Token {
			get { return TokenFactory.createToken(this); }
		}

		public List<string> allRoles {
			get { return _roles; }
			set { _roles=value; }
		}

		public string userid {
			get { return _userID; }
			set { _userID = value; }
		}

		#endregion
	}
}
